```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分布式事务：原理、挑战与解决方案</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #4a6cf7 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight::before {
            content: '';
            position: absolute;
            left: -0.25em;
            right: -0.25em;
            bottom: 0.2em;
            height: 0.3em;
            background-color: rgba(74, 108, 247, 0.3);
            z-index: -1;
            transform: rotate(-1deg);
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.65;
            margin: 0.1em 0.1em 0.1em 0;
            font-weight: 700;
            color: #4a6cf7;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 md:py-32 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">分布式事务 <br>架构设计与实现</h1>
                    <p class="text-xl md:text-2xl font-light mb-8 opacity-90">跨越服务边界的一致性保障</p>
                    <div class="flex space-x-4">
                        <a href="#concepts" class="bg-white text-blue-600 hover:bg-blue-50 px-6 py-3 rounded-full font-semibold transition duration-300">核心概念</a>
                        <a href="#solutions" class="border-2 border-white text-white hover:bg-white hover:text-blue-600 px-6 py-3 rounded-full font-semibold transition duration-300">解决方案</a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white bg-opacity-10 p-8 rounded-2xl backdrop-filter backdrop-blur-sm">
                        <div class="mermaid">
                            graph TD
                                A[分布式事务] --> B[ACID特性]
                                A --> C[挑战]
                                A --> D[解决方案]
                                B --> B1[原子性]
                                B --> B2[一致性]
                                B --> B3[隔离性]
                                B --> B4[持久性]
                                C --> C1[网络问题]
                                C --> C2[协调复杂性]
                                C --> C3[性能开销]
                                D --> D1[2PC]
                                D --> D2[3PC]
                                D --> D3[SAGA]
                                D --> D4[事务日志]
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-16">
        <!-- Introduction Section -->
        <section class="mb-20">
            <p class="drop-cap text-gray-700 text-lg leading-relaxed mb-6">分布式事务是指在分布式系统中，对跨多个服务或数据库的数据操作进行的一致性保证。与传统的单机事务不同，分布式事务涉及多个独立的服务或数据存储系统，这些系统可能在不同的物理或网络环境中。分布式事务的关键挑战在于确保所有参与的系统在事务完成后都处于一致的状态，即所有操作要么全部成功，要么全部失败，避免出现部分成功部分失败的情况。</p>
        </section>

        <!-- Concepts Section -->
        <section id="concepts" class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="highlight">1. 分布式事务的基本概念</span>
                <span class="ml-4 text-blue-500"><i class="fas fa-cube"></i></span>
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white p-8 rounded-xl shadow-md card-hover transition duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-blue-100 p-3 rounded-full mr-4">
                            <i class="fas fa-atom text-blue-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">原子性 (Atomicity)</h3>
                    </div>
                    <p class="text-gray-700">确保事务中的所有操作要么全部成功，要么全部失败。即使事务涉及多个服务或数据库，操作也应该像单一事务那样具有原子性。</p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover transition duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-green-100 p-3 rounded-full mr-4">
                            <i class="fas fa-balance-scale text-green-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">一致性 (Consistency)</h3>
                    </div>
                    <p class="text-gray-700">事务完成后，所有参与的服务或数据库应该处于一致的状态，确保数据的完整性和正确性。</p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover transition duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-purple-100 p-3 rounded-full mr-4">
                            <i class="fas fa-user-shield text-purple-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">隔离性 (Isolation)</h3>
                    </div>
                    <p class="text-gray-700">事务的执行不应受到其他并发事务的影响，每个事务的操作应该是隔离的。</p>
                </div>
                
                <div class="bg-white p-8 rounded-xl shadow-md card-hover transition duration-300">
                    <div class="flex items-center mb-4">
                        <div class="bg-yellow-100 p-3 rounded-full mr-4">
                            <i class="fas fa-shield-alt text-yellow-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-gray-800">持久性 (Durability)</h3>
                    </div>
                    <p class="text-gray-700">一旦事务提交，所有更改应该永久保存，不受系统崩溃或故障的影响。</p>
                </div>
            </div>

            <h3 class="text-2xl font-bold mb-6 text-gray-800">主要挑战</h3>
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-lg border-l-4 border-red-500 shadow-sm">
                    <h4 class="font-bold mb-2 text-gray-800">网络延迟与故障</h4>
                    <p class="text-gray-700 text-sm">网络故障或延迟可能导致参与事务的各个节点之间的通信失败，从而影响事务的一致性和可靠性。</p>
                </div>
                <div class="bg-white p-6 rounded-lg border-l-4 border-blue-500 shadow-sm">
                    <h4 class="font-bold mb-2 text-gray-800">协调复杂性</h4>
                    <p class="text-gray-700 text-sm">协调多个服务或数据库的事务操作，确保它们都达到一致状态，增加了事务管理的复杂性。</p>
                </div>
                <div class="bg-white p-6 rounded-lg border-l-4 border-green-500 shadow-sm">
                    <h4 class="font-bold mb-2 text-gray-800">性能开销</h4>
                    <p class="text-gray-700 text-sm">处理分布式事务通常涉及额外的网络通信和协调开销，这可能对系统性能产生负面影响。</p>
                </div>
            </div>
        </section>

        <!-- Solutions Section -->
        <section id="solutions" class="mb-20">
            <h2 class="text-3xl font-bold mb-12 text-gray-800 flex items-center">
                <span class="highlight">2. 分布式事务的解决方案</span>
                <span class="ml-4 text-blue-500"><i class="fas fa-lightbulb"></i></span>
            </h2>
            
            <!-- 2PC -->
            <div class="mb-16">
                <div class="flex items-center mb-6">
                    <div class="bg-blue-600 text-white px-4 py-2 rounded-lg mr-4">
                        <span class="font-bold">2PC</span>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800">两阶段提交协议</h3>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden mb-8">
                    <div class="md:flex">
                        <div class="md:w-1/2 p-8">
                            <div class="mermaid">
                                sequenceDiagram
                                    participant C as 协调者
                                    participant P1 as 参与者1
                                    participant P2 as 参与者2
                                    C->>P1: 准备请求
                                    C->>P2: 准备请求
                                    P1-->>C: 准备就绪(是/否)
                                    P2-->>C: 准备就绪(是/否)
                                    alt 全部同意
                                        C->>P1: 提交请求
                                        C->>P2: 提交请求
                                        P1-->>C: 已提交
                                        P2-->>C: 已提交
                                    else 任一拒绝
                                        C->>P1: 回滚请求
                                        C->>P2: 回滚请求
                                        P1-->>C: 已回滚
                                        P2-->>C: 已回滚
                                    end
                            </div>
                        </div>
                        <div class="md:w-1/2 p-8 bg-gray-50">
                            <h4 class="font-bold text-lg mb-4 text-gray-800">工作流程</h4>
                            <ol class="list-decimal pl-5 space-y-3 text-gray-700">
                                <li><span class="font-medium">准备阶段</span>：协调者向所有参与者发送准备请求，参与者进行事务准备操作（如锁定数据），并回复是否可以提交。</li>
                                <li><span class="font-medium">提交阶段</span>：协调者根据参与者的回复决定是否提交或回滚事务。</li>
                            </ol>
                            
                            <div class="mt-8">
                                <h4 class="font-bold text-lg mb-4 text-gray-800">优缺点</h4>
                                <div class="grid gap-4">
                                    <div class="flex items-start">
                                        <div class="bg-green-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-check text-green-600 text-xs"></i>
                                        </div>
                                        <p class="text-gray-700 flex-1">确保事务的原子性和一致性</p>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="bg-red-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-times text-red-600 text-xs"></i>
                                        </div>
                                        <div>
                                            <p class="text-gray-700">协调过程可能导致系统性能瓶颈</p>
                                            <p class="text-gray-700">参与者在准备阶段需要长时间保持锁定状态</p>
                                            <p class="text-gray-700">可能出现协调者崩溃导致的协调失败问题</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- 3PC -->
            <div class="mb-16">
                <div class="flex items-center mb-6">
                    <div class="bg-purple-600 text-white px-4 py-2 rounded-lg mr-4">
                        <span class="font-bold">3PC</span>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800">三阶段提交协议</h3>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="md:flex">
                        <div class="md:w-1/2 p-8">
                            <div class="mermaid">
                                sequenceDiagram
                                    participant C as 协调者
                                    participant P1 as 参与者1
                                    participant P2 as 参与者2
                                    C->>P1: 准备请求
                                    C->>P2: 准备请求
                                    P1-->>C: 准备就绪(是/否)
                                    P2-->>C: 准备就绪(是/否)
                                    alt 全部同意
                                        C->>P1: 预提交请求
                                        C->>P2: 预提交请求
                                        P1-->>C: 预提交确认
                                        P2-->>C: 预提交确认
                                        C->>P1: 提交请求
                                        C->>P2: 提交请求
                                        P1-->>C: 已提交
                                        P2-->>C: 已提交
                                    else 任一拒绝
                                        C->>P1: 回滚请求
                                        C->>P2: 回滚请求
                                        P1-->>C: 已回滚
                                        P2-->>C: 已回滚
                                    end
                            </div>
                        </div>
                        <div class="md:w-1/2 p-8 bg-gray-50">
                            <h4 class="font-bold text-lg mb-4 text-gray-800">工作流程</h4>
                            <ol class="list-decimal pl-5 space-y-3 text-gray-700">
                                <li><span class="font-medium">准备阶段</span>：与2PC相同，协调者向参与者发送准备请求。</li>
                                <li><span class="font-medium">预提交阶段</span>：协调者在接收到所有参与者的准备响应后，发送预提交请求，参与者完成预提交操作并回复。</li>
                                <li><span class="font-medium">提交阶段</span>：协调者在接收到所有参与者的预提交响应后，发送提交请求，参与者完成事务提交；如果有参与者无法预提交，协调者发送回滚请求。</li>
                            </ol>
                            
                            <div class="mt-8">
                                <h4 class="font-bold text-lg mb-4 text-gray-800">优缺点</h4>
                                <div class="grid gap-4">
                                    <div class="flex items-start">
                                        <div class="bg-green-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-check text-green-600 text-xs"></i>
                                        </div>
                                        <p class="text-gray-700 flex-1">增强了对协调者崩溃的容错能力</p>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="bg-red-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-times text-red-600 text-xs"></i>
                                        </div>
                                        <p class="text-gray-700 flex-1">协调过程更复杂，可能带来额外的开销</p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- SAGA -->
            <div class="mb-16">
                <div class="flex items-center mb-6">
                    <div class="bg-yellow-600 text-white px-4 py-2 rounded-lg mr-4">
                        <span class="font-bold">SAGA</span>
                    </div>
                    <h3 class="text-2xl font-bold text-gray-800">基于补偿的事务</h3>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden">
                    <div class="md:flex">
                        <div class="md:w-1/2 p-8">
                            <div class="mermaid">
                                graph LR
                                    A[开始] --> B[事务1]
                                    B --> C[事务2]
                                    C --> D[事务3]
                                    D --> E[完成]
                                    
                                    style A fill:#f8fafc,stroke:#4a6cf7
                                    style E fill:#f8fafc,stroke:#4a6cf7
                                    
                                    subgraph 正常流程
                                        B --> C --> D
                                    end
                                    
                                    subgraph 补偿流程
                                        D --失败--> Dc[补偿3]
                                        C --失败--> Cc[补偿2]
                                        B --失败--> Bc[补偿1]
                                    end
                            </div>
                        </div>
                        <div class="md:w-1/2 p-8 bg-gray-50">
                            <p class="text-gray-700 mb-4">SAGA是一种将长事务拆分为一系列短事务的方案，每个短事务都有一个对应的补偿事务。如果某个短事务失败，则执行补偿事务来撤销之前成功的短事务。</p>
                            
                            <h4 class="font-bold text-lg mb-4 text-gray-800">关键特性</h4>
                            <ul class="list-disc pl-5 space-y-2 text-gray-700">
                                <li><span class="font-medium">补偿事务</span>：每个短事务都有一个补偿事务，用于撤销短事务的效果</li>
                                <li><span class="font-medium">事务步骤</span>：长事务被分解为多个短事务，每个短事务执行后会更新全局状态</li>
                            </ul>
                            
                            <div class="mt-8">
                                <h4 class="font-bold text-lg mb-4 text-gray-800">优缺点</h4>
                                <div class="grid gap-4">
                                    <div class="flex items-start">
                                        <div class="bg-green-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-check text-green-600 text-xs"></i>
                                        </div>
                                        <div>
                                            <p class="text-gray-700">避免了长时间锁定和协调开销</p>
                                            <p class="text-gray-700">提高了系统的可用性和容错能力</p>
                                        </div>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="bg-red-100 rounded-full p-2 mr-3">
                                            <i class="fas fa-times text-red-600 text-xs"></i>
                                        </div>
                                        <div>
                                            <p class="text-gray-700">需要设计和实现补偿逻辑，增加了系统复杂性</p>
                                            <p class="text-gray-700">可能无法保证严格的一致性，尤其是在事务补偿失败的情况下</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Other Solutions -->
            <div>
                <h3 class="text-2xl font-bold mb-6 text-gray-800">其他解决方案</h3>
                <div class="grid md:grid-cols-2 gap-6">
                    <div class="bg-white p-6 rounded-xl shadow-md card-hover transition duration-300">
                        <div class="flex items-center mb-4">
                            <div class="bg-indigo-100 p-3 rounded-full mr-4">
                                <i class="fas fa-hashtag text-indigo-600 text-xl"></i>
                            </div>
                            <h4 class="text-xl font-bold text-gray-800">一致性哈希</h4>
                        </div>
                        <p class="text-gray-700">用于分布式系统中实现负载均衡，并可辅助事务管理。通过将数据和节点映射到同一个哈希环上，减少数据迁移量，提高系统稳定性。</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-md card-hover transition duration-300">
                        <div class="flex items-center mb-4">
                            <div class="bg-teal-100 p-3 rounded-full mr-4">
                                <i class="fas fa-scroll text-teal-600 text-xl"></i>
                            </div>
                            <h4 class="text-xl font-bold text-gray-800">事务日志</h4>
                        </div>
                        <p class="text-gray-700">通过记录事务操作日志，恢复系统到一致性状态。用于故障恢复和重试机制。常见的实现包括WAL(Write-Ahead Logging)和事件溯源(Event Sourcing)。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Applications Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="highlight">3. 分布式事务的应用实例</span>
                <span class="ml-4 text-blue-500"><i class="fas fa-laptop-code"></i></span>
            </h2>
            
            <div class="grid md:grid-cols-3 gap-8">
                <div class="bg-white rounded-xl overflow-hidden shadow-md card-hover transition duration-300">
                    <div class="h-48 bg-blue-500 flex items-center justify-center">
                        <i class="fas fa-database text-white text-6xl"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-3 text-gray-800">数据库中间件</h3>
                        <p class="text-gray-700">如Atomikos、Narayana等，它们通过实现两阶段提交或SAGA协议来管理分布式事务。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl overflow-hidden shadow-md card-hover transition duration-300">
                    <div class="h-48 bg-green-500 flex items-center justify-center">
                        <i class="fas fa-server text-white text-6xl"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-3 text-gray-800">微服务架构</h3>
                        <p class="text-gray-700">在微服务架构中，分布式事务用于协调不同服务的操作，如订单处理系统中，可能涉及库存、支付、物流等多个服务。</p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl overflow-hidden shadow-md card-hover transition duration-300">
                    <div class="h-48 bg-purple-500 flex items-center justify-center">
                        <i class="fas fa-file-alt text-white text-6xl"></i>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-3 text-gray-800">分布式文件系统</h3>
                        <p class="text-gray-700">如HDFS，使用分布式事务来确保数据的写入和读取一致性。</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 flex items-center">
                <span class="highlight">4. 方案对比与选择建议</span>
                <span class="ml-4 text-blue-500"><i class="fas fa-chart-bar"></i></span>
            </h2>
            
            <div class="bg-white rounded-xl shadow-md overflow-hidden">
                <div class="overflow-x-auto">
                    <table class="w-full">
                        <thead class="bg-gray-100">
                            <tr>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">方案</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">一致性</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">性能</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">复杂性</th>
                                <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">适用场景</th>
                            </tr>
                        </thead>
                        <tbody class="divide-y divide-gray-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">2PC</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">高</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">低</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">中</td>
                                <td class="px-6 py-4 text-gray-700">短事务、强一致性要求的系统</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">3PC</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">高</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">中</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">高</td>
                                <td class="px-6 py-4 text-gray-700">需要更高容错能力的系统</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap font-medium text-gray-900">SAGA</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">最终</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">高</td>
                                <td class="px-6 py-4 whitespace-nowrap text-gray-700">高</td>
                                <td class="px-6 py-4 text-gray-700">长事务、高可用性要求的系统</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            
            <div class="mt-8 bg-blue-50 p-6 rounded-xl">
                <h3 class="text-xl font-bold mb-4 text-gray-800">选择建议</h3>
                <ul class="list-disc pl-5 space-y-2 text-gray-700">
                    <li><span class="font-medium">强一致性需求</span>：优先考虑2PC或3PC</li>
                    <li><span class="font-medium">高性能需求</span>：考虑SAGA或事件驱动架构</li>
                    <li><span class="font-medium">长时间运行事务</span>：SAGA是最佳选择</li>
                    <li><span class="font-medium">简单场景</span>：可以考虑本地消息表或事务日志</li>
                </ul>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索分布式系统的奥秘</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition duration-300 flex items-center">
                        <i class="fas fa-external-link-alt mr-2"></i>
                        www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
                © 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            },
            sequence: {
                diagramMarginX: 50,
                diagramMarginY: 10,
                boxTextMargin: 5,
                noteMargin: 10,
                messageMargin: 35,
                mirrorActors: false
            }
        });
    </script>
</body>
</html>
```